import Vue from 'vue'
//路由方法集
import VRouter from 'vue-router'
//首页
import index from '../index'
//404页面
import NotFoundComponent from '../components/other/NotFoundComponent'
//登录注册模块(暂时没有设计图)
import loginAll from '../components/Login/loginAll'
import ToLogin from '../components/Login/ToLogin'
import ToPhone from '../components/Login/ToPhone'
import ToCode from '../components/Login/ToCode'
import ToPassWord from '../components/Login/ToPassWord'
import ResetPswds from '../components/Login/ResetPswds'

//油卡充值模块
import cardoilAll from '../components/Cardoil/cardoilAll'
import refillCard from '../components/Cardoil/refillCard'
import rechargeRecord from '../components/Cardoil/rechargeRecord'
import termsService from '../components/Cardoil/termsService'
import discountDetails from '../components/Cardoil/discountDetails'
import receiveMesg from '../components/Cardoil/receiveMesg'
//车辆团购模块
import buyingAll from '../components/Buying/buyingAll'
import buyCarList from '../components/Buying/buyCarList'
import buyCarProduct from '../components/Buying/buyCarProduct'

//车险申报模块
import autoinsuranAll from '../components/AutoInsuran/autoinsuranAll'
import autoinsuran from '../components/AutoInsuran/autoinsuran'
import autoapply from '../components/AutoInsuran/autoapply'
import idapply from '../components/AutoInsuran/idapply'
import autoterm from '../components/AutoInsuran/autoterm' // 车油宝服务条款

// 积分商城模块
import intshopAll from '../components/IntShop/intshopAll'

// 个人中心模块
import mycentreAll from '../components/MyCentre/mycentreAll'
import mycenter from '../components/MyCentre/mycenter' // 个人中心
import mypoint from '../components/MyCentre/mypoint' // 我的积分
import myoilcard from '../components/MyCentre/myoilcard' // 我的油卡
import mycode from '../components/MyCentre/mycode' // 我的二维码
import myauto from '../components/MyCentre/myauto' // 我的车险

// 个人中心-推广
import myextend from '../components/MyCentre/myextend' // 我的推广
import addextend from '../components/MyCentre/myextend/addextend' // 推广会员 
import signup from '../components/MyCentre/myextend/signup' // 推广会员注册
import download from '../components/MyCentre/myextend/download' // 推广直接下载

// 个人中心模块 - 设置
import setup from '../components/MyCentre/setup' // 设置
import account from '../components/MyCentre/setup/account' // 账户设置
import nickname from '../components/MyCentre/setup/nickname' // 修改昵称
import phones from '../components/MyCentre/setup/phones' // 修改号码
import newphones from '../components/MyCentre/setup/newphones'
// 密码管理
import verpwd from '../components/MyCentre/setup/verpwd' // 验证码修改密码
import oldpwd from '../components/MyCentre/setup/oldpwd' // 旧密码修改密码
import modifypwd from '../components/MyCentre/setup/modifypwd' // 密码管理
import typepwd from '../components/MyCentre/setup/typepwd' // 修改密码方式
import tipsetpwd from '../components/MyCentre/setup/tipsetpwd' // 初始密码
import setpwd from '../components/MyCentre/setup/setpwd' // 初始密码设置

// 我的油卡 添加/信息
import addoilcard from '../components/MyCentre/myoilcard/addoilcard' // 添加油卡
import oilcardinfo from '../components/MyCentre/myoilcard/oilcardinfo' // 油卡信息

Vue.use(VRouter)
let router = new VRouter({
	mode: 'history',
	routes: [{
			path: '/',
			redirect: '/loginAll',
			component: index
		},
		{
			path: '*',
			name: '404页面',
			component: NotFoundComponent
		},
		{
			path: '/loginAll',
			name: '登录注册模块',
			component: loginAll,
			redirect: '/LoginAll/ToLogin',
			children: [{
					path: '/LoginAll/ToLogin',
					component: ToLogin
				},
				{
					path: '/LoginAll/ToPhone',
					component: ToPhone,
					children: [{
						path: ':type'
					}]
				},
				{
					path: '/LoginAll/ToCode',
					component: ToCode,
					children: [{
						path: "/LoginAll/ToCode/:type/:phone"
					}]
				},
				{
					path: '/LoginAll/ToPassWord',
					component: ToPassWord,
					children: [{
						path: "/LoginAll/ToPassWord/:yzm/:phone"
					}]
				},
				{
					path: '/LoginAll/ResetPswds',
					component: ResetPswds,
					children: [{
						path: "/LoginAll/ResetPswds/:yzm/:phone"
					}]
				}
			]
		},
		{
			path: '/cardoilAll',
			component: cardoilAll,
			redirect: '/cardoilAll/refillCard',
			children: [{
					path: '/cardoilAll/refillCard',
					name: '油卡充值',
					component: refillCard
				},
				{
					path: '/cardoilAll/rechargeRecord',
					name: '充值记录',
					component: rechargeRecord
				},
				{
					path: '/cardoilAll/termsService',
					name: '油卡充值服务条款',
					component: termsService
				},
				{
					path:'/cardoilAll/discountDetails',
					name:'等级折扣说明',
					component:discountDetails
				},
				{
					path:'/cardoilAll/receiveMesg',
					name:'填写信息',
					component:receiveMesg
				}
			]
		},
		{
			path: '/buyingAll',
			component: buyingAll,
			redirect: '/buyingAll/buyCarList',
			children: [{
					path: '/buyingAll/buyCarList',
					name: '车辆团购',
					component: buyCarList
				},
				{
					path: '/buyingAll/buyCarProduct',
					name: '车辆详情',
					component: buyCarProduct
				}
			]
		},
		{
			path: '/autoinsuranAll',
			name: '车险申报首页',
			component: autoinsuranAll,
			redirect: '/autoinsuranAll/autoinsuran',
			children: [{
					path: '/autoinsuranAll/autoinsuran',
					name: '车险申报',
					component: autoinsuran
				},
				{
					path: '/autoinsuranAll/autoapply',
					name: '车险申报-行驶证',
					component: autoapply
				},
				{
					path: '/autoinsuranAll/idapply',
					name: '车险申报-身份证',
					component: idapply
				},
				{
					path: '/autoinsuranAll/autoterm',
					name: '车险服务条款',
					component: autoterm
				},

			]
		},
		{
			path: '/intshopAll',
			name: '积分商城模块',
			component: intshopAll
		},
		{
			path: '/mycentreAll',
			name: '个人中心模块',
			component: mycentreAll,
			redirect: '/mycentreAll/mycenter',
			children: [{
					path: '/mycentreAll/mycenter',
					name: '个人中心',
					component: mycenter
				},
				{
					path: '/mycentreAll/mypoint',
					name: '我的积分',
					component: mypoint
				},
				{
					path: '/mycentreAll/myoilcard',
					name: '我的油卡',
					component: myoilcard
				},
				{
					path: '/mycentreAll/mycode',
					name: '我的二维码',
					component: mycode
				},
				{
					path: '/mycentreAll/myauto',
					name: '我的车险',
					component: myauto
				},
				{
					path: '/mycentreAll/setup',
					name: '设置',
					component: setup
				},
				{
					path: '/mycentreAll/verpwd',
					name: '验证码修改密码',
					component: verpwd
				},
				{
					path: '/mycentreAll/account',
					name: '账户设置',
					component: account
				},
				{
					path: '/mycentreAll/nickname',
					name: '设置昵称',
					component: nickname
				},
				{
					path: '/mycentreAll/phones',
					name: '手机绑定',
					component: phones
				},
				{
					path: '/mycentreAll/newphones',
					name: '更换手机',
					component: newphones
				},
				{
					path: '/mycentreAll/addoilcard',
					name: '添加油卡',
					component: addoilcard
				},
				{
					path: '/mycentreAll/oilcardinfo',
					name: '油卡详情',
					component: oilcardinfo
				},
				{
					path: '/mycentreAll/modifypwd',
					name: '密码管理',
					component: modifypwd
				},
				{
					path: '/mycentreAll/typepwd',
					name: '密码修改类型',
					component: typepwd
				},
				{
					path: '/mycentreAll/oldpwd',
					name: '旧密码修改密码',
					component: oldpwd

				},
				{
					path: '/mycentreAll/tipsetpwd',
					name: '设置密码',
					component: tipsetpwd
				},
				{
					path: '/mycentreAll/setpwd',
					name: '设置初始密码',
					component: setpwd
				},

				{
					path: '/mycentreAll/myextend',
					name: '我的推广',
					component: myextend
				},
				{
					path: '/mycentreAll/addextend',
					name: '推广会员',
					component: addextend
				},
				{
					path: '/mycentreAll/signup',
					name: '推广登录',
					component: signup
				}
			]
		},
		{
			path: '/download',
			name: '下载',
			component: download
		}

	]
});
router.afterEach(function(transition) {
	if(transition.name) {
		document.title = transition.name;
	}
});

export default router;